home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / HippoDraw / hippo / hippostruct.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-28  |  5.2 KB  |  204 lines

  1. #ifndef _HIPPOSTRUCT_H_
  2. #define _HIPPOSTRUCT_H_
  3.  
  4. /*
  5.  * hippostruct.h - definitions to structures in hippo package.
  6.  * Structures were put in a separate file so the RCS version
  7.  * number changes only when the structures have been changed.
  8.  *
  9.  * Paul Rensing, May 2, 1991 
  10.  *
  11.  * Copyright (C)  1991  The Board of Trustees of The Leland Stanford
  12.  * Junior University.  All Rights Reserved.
  13.  *
  14.  * $Id: hippostruct.h,v 3.8 1992/03/19 02:13:21 rensing Rel $
  15.  */
  16.  
  17.  
  18. /*
  19.  * ntuple/display structure version number (maintained by RCS)
  20.  */
  21. #define STRUCT_VERSION "$Id: hippostruct.h,v 3.8 1992/03/19 02:13:21 rensing Rel $"
  22.  
  23. /*
  24.  * the "magic number", which is "h_" (in ASCII), 
  25.  *     for the start of hippo data files.
  26.  */
  27. #define MAGIC "\150\137"    /* circumvent the EBCDIC strings */
  28.  
  29. /*
  30.  * allowed length of function name used in registry.
  31.  */
  32. #define FUNCNAMELEN 32
  33.  
  34. /*
  35.  * a rectangle. Designed to match NeXT's NXRect
  36.  */
  37. typedef struct
  38. {
  39.      struct 
  40.      {
  41.       float x, y;
  42.      } origin;
  43.      struct
  44.      {
  45.       float width, height;
  46.      } size;
  47. } rectangle;
  48.  
  49.  
  50. /*
  51.  * structure to keep lists of functions.
  52.  * Maintain as linked lists for ease of use.
  53.  */
  54. typedef struct fid_str
  55. {
  56.      char name[FUNCNAMELEN+1];
  57.      int (*funcPtr)();
  58.      double *paramBlk;
  59.      int blkSize;        /* parameter block size in nParam */
  60.      linestyle_t lineStyle;    /* linestyle; needed for overplot funcs */
  61.      struct fid_str *next;
  62. } func_id_t, *func_id;
  63.  
  64. typedef struct
  65. {
  66.      struct 
  67.      {
  68.       char fixed;        /* fixed bins */
  69.       char dirty;        /* bins are dirty, re-bin */
  70.       char dummies[2];    /* keep struct length to multiply of 4 */
  71.      } flags;
  72.  
  73.      struct 
  74.      {
  75.       int nBins;
  76.       float low;
  77.       float high;
  78.       float moments[3];    /* moments[n] = sum of weight*var^n */
  79.      } xAxis, yAxis;
  80.  
  81.      float *data;        /* contents of bins */
  82.      float *variance;        /* variance (error^2) of bins */
  83.      float totals[3][3];    /* overflow and underflow */
  84.      float binMin;
  85.      float binMax;
  86.      int binAlloc;        /* amount of space allocated for bins */
  87.      int ndata;            /* number of data points binned */
  88. } bins_t;
  89.  
  90.      
  91. typedef struct
  92. {
  93.      float low;            /* lower limit for axis */
  94.      float high;        /* upper limit for axis */
  95.      char *label;        /* label for axis */
  96.      struct 
  97.      {
  98.       char log;        /* false=linear axis,true=log10 axis */
  99.       char autoScale;    /* flag to autoscale axis */
  100.       char tickLocation;    /* or of LEFT,RIGHT,TOP,BOTTOM  */
  101.       char labelLocation;
  102.       char scaleLocation;
  103.       char autoTick;
  104.       char dummies[2];    /* keep struct length to multiply of 4 */
  105.      } flags;
  106.      float tickLength;
  107.      float scaleFontSize;
  108.  
  109.      float firstTick;
  110.      float tickStep;
  111.      int numMinorTicks; /* number of minor ticks betw. major */
  112. } axis_t;
  113.  
  114. typedef struct
  115. {
  116.      int x;            /* n-tuple variable we use as x     */
  117.      int y;            /*   "        "       "       y     */
  118.      int z;            /*   "        "       "       z     */
  119.      int weight;        /*   "        "       "     weight  */
  120.      int xerror;        /*   "        "       "     x error */
  121.      int yerror;        /*   "        "       "     y error */
  122. } bind_strt_t;
  123.  
  124.  
  125. /*
  126.  * Structure defining the data for an n-tuple.
  127.  */
  128. typedef struct
  129. {
  130.      int ndim;            /* number of dimensions of data */
  131.      int rev;            /* revision number; incr if clear n-tuple */
  132.  
  133.      float *data;        /* array of data */
  134.      int ndata;            /* number of data points */
  135.      int memAlloc;        /* size of data array */
  136.  
  137.      int extremeBad;            /* TRUE if nlow/nhigh could be bad */
  138.      float *nlow;        /* lowest value for dimension n */
  139.      float *nhigh;        /* highest value for dimension n */
  140.  
  141.      char *title;        /* title of whole ntuple */
  142.      char **label;        /* label for dimension n */
  143. } ntuple_t, *ntuple;
  144.  
  145.  
  146. /*
  147.  * Structure defining data for a hippo display.
  148.  */
  149. typedef struct
  150. {
  151.      ntuple ntuple;        /* ntuple from which bins are made */
  152.      int nt_rev;        /* rev no. of ntuple when last displayed */
  153.      char *ntFile;        /* file name for ntuple if by reference */
  154.  
  155.      int dim;            /* dimension of graph; internal only */
  156.      graphtype_t graphtype;    /* type of graph, e.g. lego, scatter, etc */
  157.      drawtype_t drawtype;    /* type of drawing, e.g. point, line, etc */
  158.  
  159.      struct 
  160.      {
  161.       char drawTitles;    /* if true, draw titles and axis labels */
  162.       char drawAxes;    /* if true, draw axes */
  163.       char ntByReference;    /* variable "ntuple" is actually integer */
  164.       char dummies[5];
  165.      } flags;
  166.      
  167.      char *title;        /* title */
  168.  
  169.      bins_t bins;        /* the bins */
  170.      
  171.      axis_t xAxis,yAxis,zAxis;
  172.      
  173.      plotsymbol_t plotSymbol;    /* plot symbol, line style */
  174.      float symbolSize;
  175.      linestyle_t lineStyle;
  176.      
  177.      bind_strt_t binding;    /* binding of n-tuple dim. to plot quantity */
  178.      
  179.      rectangle drawRect;    /* specify rectangle within which we draw */
  180.      rectangle marginRect;    /* the margin area within the above */
  181.  
  182.      func_id nt_cut;        /* list of cuts on ntuple data */
  183.      func_id bin_func;        /* list of bin transform funcs */
  184.      func_id plot_func;        /* list of overplot functions */
  185.      func_id binToColor;    /* transfer function for greyscale/color */
  186. } display_t, *display;
  187.  
  188.  
  189. /*
  190.  * structure to hold a hippo record. Only used by the internal IO routines.
  191.  */
  192. typedef struct
  193. {
  194.      char *magic;
  195.      char *s_version;
  196.      ntuple *nt_list;
  197.      int num_nt;
  198.      display *disp_list;
  199.      int num_disp;
  200. } hippo_rec;
  201.  
  202.  
  203. #endif                /* _HIPPOSTRUCT_H_ */
  204.